﻿<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>lagou manage</title>
<meta name="description" content="拉勾数据">
<meta name="keywords" content="二手房 房产经济 房企 开发商 拉勾数据 IFS">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="icon" type="image/png" href="assets/i/favicon.png">
<link rel="apple-touch-icon-precomposed"
	href="assets/i/app-icon72x72@2x.png">
<meta name="apple-mobile-web-app-title" content="eosms for IFS" />
<link rel="stylesheet" href="assets/css/amazeui.min.css" />
<link rel="stylesheet" href="assets/css/admin.css">
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->

	<jsp:include page="/manage_header.do" flush="true" />

	<div class="am-cf admin-main">
		<!-- sidebar start -->
		<jsp:include page="/manage_tree.do" flush="true"></jsp:include>
		<!-- sidebar end -->

		<!-- content start -->
		<div class="admin-content">
			<div class="am-cf am-padding">
				<div class="am-fl am-cf">
					<strong class="am-text-primary am-text-lg">工作详情</strong> / <small>job</small>
				</div>
			</div>
			<input type="hidden" name="id" id="id" value="${job.id}">
			<input type="hidden" name="page_num" id="page_num" value="0">
			<div class="am-tabs am-margin" data-am-tabs>
				<ul class="am-tabs-nav am-nav am-nav-tabs">
					<li class="am-active"><a href="#tab1">详细信息</a></li>
				</ul>

				<div class="am-tabs-bd">
					<div class="am-tab-panel am-fade am-in am-active" id="tab1">
					
						<div class="am-g am-margin-top">
							<div class="am-u-sm-3 am-u-md-3 am-u-lg-3">
								发布人：${job.user.name}
							</div>
							<div class="am-u-sm-3 am-u-md-3 am-u-lg-3">
								发布状态： <c:if test="${ job.release_status == 0 }">未发布</c:if> 
									     <c:if test="${ job.release_status == 1 }">已发布</c:if>
							</div>
							<div class="am-u-sm-6 am-u-md-6 am-u-lg-6">
								<fmt:parseDate value="${job.create_time}" var="create_time" pattern="yyyy-MM-dd HH:mm:ss"/>
								发布时间：<fmt:formatDate value="${create_time}" pattern="yyyy-MM-dd HH:mm:ss"/>
							</div>
						</div>
						
						<div class="am-g am-margin-top">
							<div class="am-u-sm-6 am-u-md-6 am-u-lg-6">
								详细地址： ${job.address}-${job.community} ${job.building}栋${job.cell}单元 ${job.number}号
							</div>
							<div class="am-u-sm-3 am-u-md-3 am-u-lg-3">
								装修类型： <c:if test="${job.decoration_type == 1}">毛坯装修</c:if>
										 <c:if test="${job.decoration_type == 2}">旧房改造</c:if>
							</div>
							<div class="am-u-sm-3 am-u-md-3 am-u-lg-3">
								<p class="am-text-warning">修改状态：
										<select id="status" name="status">
											<option value=0 <c:if test='${job.status == 0}'>selected</c:if>>删除</option>
											<option value=1 <c:if test='${job.status == 1}'>selected</c:if>>正常</option>
										</select>
								</p>
							</div>
						</div>
						
					</div>
				  </div>
				  
				</div>
				
				<!-- 弹出框开始 -->
				<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm">
				  <div class="am-modal-dialog">
				    <div class="am-modal-hd">好活儿</div>
				    <div class="am-modal-bd">
				     	你，确定要改变这条记录状态吗？
				    </div>
				    <div class="am-modal-footer">
				      <span class="am-modal-btn" data-am-modal-cancel>取消</span>
				      <span class="am-modal-btn" data-am-modal-confirm>确定</span>
				    </div>
				  </div>
				</div>
				<!-- 弹出框结束 -->
				
				<div class="am-g">
					<div class="am-u-sm-12">
						<table id="data_table"
							class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<tr>
									<th class="table-title" width="12.5%">所需工种</th>
									<th class="table-title" width="12.5%">薪水</th>
									<th class="table-title" width="12.5%">开始时间</th>
									<th class="table-title" width="12.5%">结束时间</th>
									<th class="table-title" width="12.5%">面积</th>
									<th calss="table-title" width="12.5%">加急费</th>
									<th calss="table-title" width="12.5%">工作项状态</th>
									<th calss="table-title" width="12.5%">数据状态</th>
								</tr>
							</thead>
							<tbody id="data_tbody">
								<c:forEach var="jobitem" items="${jobitems}" varStatus="s">
									<tr class="tr_click" id="tr_${jobitem.id}"
										jobitem_id="${jobitem.id}">
										<td id="td_name_${jobitem.id}">${jobitem.jobtype.name}</td>
										<td id="td_salary_${jobitem.id}"><fmt:formatNumber value="${jobitem.salary}" type="currency"/>元/天</td>
										<td id="td_start_date_${jobitem.id }">
											<c:if test="${jobitem.jobitem_status == 1}">
												<fmt:parseDate value="${jobitem.start_date}" var="start_date" pattern="yyyy-MM-dd HH:mm:ss"/>
												<fmt:formatDate value="${start_date}" pattern="yyyy-MM-dd HH:mm:ss"/>
											</c:if>
											<c:if test="${jobitem.jobitem_status != 1}">未开始</c:if>
										</td>
										<td id="td_end_date_${jobitem.id }">
											<c:if test="${jobitem.jobitem_status == 2}">
												<fmt:parseDate value="${jobitem.end_date}" var="end_date" pattern="yyyy-MM-dd HH:mm:ss"/>
												<fmt:formatDate value="${end_date}" pattern="yyyy-MM-dd HH:mm:ss"/>
											</c:if>
											<c:if test="${jobitem.jobitem_status != 2}">未结束</c:if>
										</td>
										<td id="td_area_${jobitem.id }">
											${jobitem.area }
											<c:if test="${jobitem.unit == 1 }">平米</c:if>
											<c:if test="${jobitem.unit == 2 }">延米</c:if>
										</td>
										<td id="td_urgent_fee_${jobitem.id }">
											<c:if test="${jobitem.urgent_status == 0 }">未加急</c:if>
											<c:if test="${jobitem.urgent_status == 1 }"><fmt:formatNumber value="${jobitem.urgent_fee}" type="currency"/></c:if>
										</td>
										<td id="td_jobitem_status_${jobitem.id }">
												<c:if test="${jobitem.jobitem_status == -2}">结束</c:if>
												<c:if test="${jobitem.jobitem_status == -1}">待评价</c:if>
												<c:if test="${jobitem.jobitem_status == 0}">未接单</c:if>
												<c:if test="${jobitem.jobitem_status == 1}">施工中</c:if>
												<c:if test="${jobitem.jobitem_status == 2}">有接单，等待选中</c:if>
												<c:if test="${jobitem.jobitem_status == 3}">已选定工人</c:if>	
												<c:if test="${jobitem.jobitem_status == 4}">工人请求完工</c:if>
												<c:if test="${jobitem.jobitem_status == 5}">请求开工</c:if>
										</td>
										<td id="${jobitem.id }" jobitem_status="${jobitem.status }" class="td_click">
											<c:if test="${jobitem.status == 1}">
												<button type="button" class="am-btn am-btn-primary am-active">正常</button>
											</c:if>
											<c:if test="${jobitem.status == 0}">
												<button type="button" class="am-btn am-btn-danger am-active">删除</button>
											</c:if>
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						<div class="am-cf">
							共<b id="pageCount"> ${page.allRow}</b> 条记录
							<div class="am-fr">
								<ul class="am-pagination">
									<c:choose>
										<c:when test="${page.currentPage==1}">
											<li class="am-disabled"><a href="#">«</a></li>
										</c:when>
										<c:when test="${page.currentPage!=1}">
											<li><a href="javascript:void(0)"
												onclick="choose_page(${page.currentPage-1})">«</a></li>
										</c:when>
									</c:choose>
									<c:forEach var="i" begin="1" end="${page.totalPage}" step="1">
										<c:choose>
											<c:when test="${page.currentPage==i}">
												<li class="am-active"><a href="javascript:void(0)"><c:out
															value="${i}" /></a></li>
											</c:when>
											<c:when test="${page.currentPage!=i}">
												<li><a href="javascript:void(0)"
													onclick="choose_page(${i})"><c:out value="${i}" /></a></li>
											</c:when>
										</c:choose>
									</c:forEach>
									<c:choose>
										<c:when test="${page.currentPage==page.totalPage}">
											<li class="am-disabled"><a href="#">»</a></li>
										</c:when>
										<c:when test="${page.currentPage!=page.totalPage}">
											<li><a href="javascript:void(0)"
												onclick="choose_page(${page.currentPage+1})">»</a></li>
										</c:when>
									</c:choose>
								</ul>
							</div>
						</div>
					</div>
				</div>
		</div>
		<!-- content end -->

	</div>

	<a href="#" class="am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"><span class="am-icon-btn am-icon-th-list"></span></a>
	<!-- foot start -->
	<jsp:include page="/manage_foot.do" flush="true" />
	<!-- foot end -->
</body>
</html>

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<script src="assets/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="assets/js/amazeui.min.js"></script>
<script src="assets/js/app.js"></script>
<script type="text/javascript">
$(function() {
	//修改工作状态
	$("#status").change(function(){
		$('#my-confirm').modal({
	        relatedTarget: this,
	        onConfirm: function(options) {
	        	$.ajax({
	    			contentType:"application/json",
	    			type : "GET",
	    			url : "<%=request.getContextPath()%>/update_job_status.do?id="+$("#id").val()+"&status="+$("#status").val(),
	    			dataType: "json",
	    			success : function(data) {
	    				if(data.flag=="1"){				
	    		            alert("修改成功！");
	    		        }
	    		        else{
	    		            alert("修改失败！");
	    		        }
	    		    },
	    		    error :function(){
	    		        alert("网络连接出错！");
	    		    }
	        	});
	        },
	        // closeOnConfirm: false,
	        onCancel: function() {
	          if($("#status").val()==1){
	        	  $("#status").val(0);
	          }
	          if($("#status").val()==0){
	        	  $("#status").val(1);
	          }
	        }
	      });
	});

	
	//列表点击事件
	 $(".tr_click").click(function(){
		 location.href="<%=request.getContextPath()%>/get_jobitem.do?id="+$(this).attr("jobitem_id");
	 });
});
</script>